#include <bits/stdc++.h>
using namespace std;
#define f(i,j,k) for(long long i=j;i<k;i++)
#define cond(a) if(a)cout<<"YES"<<endl;else cout<<"NO"<<endl
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
#define test int t;cin>>t;while(t--)
#define endl "\n"
#define pb push_back
#define mp make_pair
#define D(x) cerr << #x << " = " << (x) << '\n'
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
typedef long long ll;
ll gcd(ll a, ll b) {
return b ? gcd(b, a % b) : a;
}
ll lcm(ll a, ll b)
{
return (a*b)/gcd(a,b);
}
ll PRO(ll a,ll b,ll MOD)
{
return ((a%MOD)*(b%MOD)%MOD);
}
ll power(ll x, ll y, ll M)
{
if (y == 0)
return 1;
ll p = power(x, y / 2, M) % M;
p = (p * p) % M;
return (y % 2 == 0) ? p : (x * p) % M;
}
ll modInverse(ll A, ll M)
{
ll g = gcd(A, M);
if (g != 1)
return -1;
else {
return power(A, M - 2, M);
}
}
bool isprime(int n)
{
for(int i=2;i*i<=n;i++)
{
if(n%i==0)return false;
}
return true;
}
ll fact(ll n)
{
if(n==0)
return 1;
ll res = 1;
for (ll i=2;i<=n;i++)
res=1ll * res*i;
return res;
}
ll C(ll n, ll r)
{
ll z=1;
f(i,0,r)
{
z=z*(n-i)/(i+1);
}
return z;
}
const int N=500500;
bool prime[N + 1];
void SieveOfEratosthenes(int n)
{
memset(prime, true, sizeof(prime));
for (int p=2;p*p<=n;p++){
if (prime[p] == true) {
for (int i = p * p; i <= n; i += p)
prime[i] = false;
}
}
}
int lowbit(int x)
{
return x&(-x);
}
void solve()
{
int n;
cin>>n;
int a[n];
f(i,0,n)cin>>a[i];
set<int>v;
for(int i=1;i*i<=n;i++)
{
if(n%i==0)
{
v.insert(i);
v.insert(n/i);
}
}
for(int x:v)
{
for(int i=0;i<x;i++)
{
bool check=true;
int nb=0;
for(int j=i;j<n;j+=x)
{
nb++;
if(a[j]==0)
{
check=false;
break;
}
}
if(check && nb>2)
{
yes;
return;
}
}
}
no;
}
int main()
{
//test
//{
solve();
//}
return 0;
}
1920. Build Array from Permutation | 494. Target Sum |
797. All Paths From Source to Target | 1547B - Alphabetical Strings |
1550A - Find The Array | 118B - Present from Lena |
27A - Next Test | 785. Is Graph Bipartite |
90. Subsets II | 1560A - Dislike of Threes |
36. Valid Sudoku | 557. Reverse Words in a String III |
566. Reshape the Matrix | 167. Two Sum II - Input array is sorted |
387. First Unique Character in a String | 383. Ransom Note |
242. Valid Anagram | 141. Linked List Cycle |
21. Merge Two Sorted Lists | 203. Remove Linked List Elements |
733. Flood Fill | 206. Reverse Linked List |
83. Remove Duplicates from Sorted List | 116. Populating Next Right Pointers in Each Node |
145. Binary Tree Postorder Traversal | 94. Binary Tree Inorder Traversal |
101. Symmetric Tree | 77. Combinations |
46. Permutations | 226. Invert Binary Tree |